package ar.com.gals.service;

import ar.com.gals.domain.Rol;
import ar.com.gals.error.GalsException;
import ar.com.gals.repository.RolRepository;

public class RolService extends AbstractService<Rol> {

	public RolService() {
		this.domain = Rol.class;
	}
	
	
	public Rol getByName(String rolName) throws GalsException {
		
		Rol rol = null;
		
		try
		{
			this.beginTransaction();
		
			rol = new RolRepository(this.session).getByName(rolName);
			
			this.commit();
		}
		catch(Exception e) {
			
			this.rollback();
			
			throw new GalsException(e.getMessage());
		}
		
		return rol;
	}
}
